#include "modifypwdwindow.h"
#include "ui_modifypwdwindow.h"
#include "publicstruct.h"

#include <QFile>
#include <QStyleOption>

ModifyPwdWindow::ModifyPwdWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ModifyPwdWindow)
{
    ui->setupUi(this);
    // 窗口渲染
    setQssStyle(QString("../style/ModifyPwdWindow.qss"),this);

    ui->btn_pre->setVisible(false);

    // 关闭按钮失效
    // this->setWindowFlags(Qt::WindowMinMaxButtonsHint);
    // 隐藏最小化、最大化按钮,只保留关闭按钮
//    this->setWindowFlags(Qt::WindowCloseButtonHint);
    // 无边框
    this->setWindowFlags(Qt::FramelessWindowHint);
}

ModifyPwdWindow::~ModifyPwdWindow()
{
    delete ui;
}

void ModifyPwdWindow::Show()
{
    ui->stackedWidget->setCurrentWidget(ui->page);
    ui->btn_pre->setVisible(false);
    show();
}

void ModifyPwdWindow::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.initFrom(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

void ModifyPwdWindow::on_btn_next_clicked()
{
    ui->stackedWidget->setCurrentWidget(ui->page_2);
    ui->btn_pre->setVisible(true);
}


void ModifyPwdWindow::on_btn_close_clicked()
{
    this->close();
}


void ModifyPwdWindow::on_btn_pre_clicked()
{
    ui->stackedWidget->setCurrentWidget(ui->page);
    ui->btn_pre->setVisible(false);
}

